import request from "./http";

// 通用页面接口
// * 查询注册码
export function getSNinfo() {
  return request({
    url: "api/sn-info",
    method: "get",
  });
}

// * 登陆注册码
export function saveSNinfo(params) {
  return request({
    url: "api/sn-info",
    method: "post",
    headers: {
      "Content-Type": "application/json",
      Accept: "*/*",
    },
    data: params,
  });
}

// * 修改系统密码
export function passwdModify(params) {
  return request({
    url: "api/os-passwd-modify",
    method: "post",
    headers: {
      "Content-Type": "application/json",
      Accept: "*/*",
    },
    data: params,
  });
}

// * 读取采集通道XML文件
export function getChannel() {
  return request({
    url: "soft-link/channel.xml",
    method: "get",
  });
}

// * 上传文件
export function channelUpload(params) {
  return request({
    url: "api/upload",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      Accept: "*/*",
    },
    data: params,
  });
}
// * 扫描协议库
export function scanProtocol_manage() {
  return request({
    url: "/protocol_manage/scan",
    method: "get",
  });
}
// * 查询规约
export function infoPtlSo() {
  return request({
    url: "/protocol_manage/protocol",
    method: "get",
  });
}
// * 查询数据类型
export function commondatatype() {
  return request({
    url: "/common/data_type",
    method: "get",
  });
}
// * 查询应用类型组
export function commonAppTypeGroup() {
  return request({
    url: "/template/app_type/",
    method: "get",
  });
}
// * 查询数据编码
export function commonDataCode() {
  return request({
    url: "/common/data_code",
    method: "get",
  });
}
// 	 * 转发通道 -- 添加设备
export function addDevicechun(params) {
  return request({
    url: "/device_config/device/",
    method: "POST",
    data: params,
  });
}
// 	 * 转发通道 -- 批量添加设备
export function batchAddDevicechun(params) {
  return request({
    url: "/device_config/batch_add/",
    method: "POST",
    data: params,
  });
}
// 	 * 转发通道 -- 修改设备
export function editDevicechun(params) {
  return request({
    url: "/device_config/device/",
    method: "PUT",
    data: params,
  });
}
// 	 * 批量修改设备
export function batchEditDevicechun(params) {
  return request({
    url: "/device_config/batch_update/",
    method: "post",
    data: params,
  });
}
// 	 * 转发通道 -- 删除设备
export function delDevicechun(params) {
  return request({
    url: `/device_config/device/${params}`,
    method: "DELETE",
  });
}
// 	 * 转发通道 -- 批量删除设备
export function batchDelDevicechun(params) {
  return request({
    url: `/device_config/batch_delete/`,
    method: "DELETE",
    data: params,
  });
}
// 	 * 转发通道 -- 查询设备id是否绑定了iec10x扩展参数
export function getiec10xexBind(params) {
  return request({
    url: `/transmit/iec10xex/bind/${params}`,
    method: "get",
  });
}
// 	 * 转发通道 -- 根据设备id获取iec10x扩展参数
export function getiec10xex(params) {
  return request({
    url: `/transmit/iec10xex/${params}`,
    method: "get",
  });
}
// 	 * 转发通道 -- 新增iec10x扩展参数绑定设备
export function addiec10xex(params) {
  return request({
    url: `/transmit/iec10xex`,
    method: "POST",
    data: params,
  });
}
// 	 * 转发通道 -- 修改iec10x扩展参数绑定设备
export function editiec10xex(params) {
  return request({
    url: `/transmit/iec10xex`,
    method: "PUT",
    data: params,
  });
}
// 	 * 转发通道 -- 查询设备id是否绑定了iec10x扩展参数
export function getModbusexBind(params) {
  return request({
    url: `/transmit/modbusex/bind/${params}`,
    method: "get",
  });
}
// 	 * 转发通道 -- 根据设备id获取modbus扩展参数
export function getModbusex(params) {
  return request({
    url: `/transmit/modbusex/${params}`,
    method: "get",
  });
}
// 	 * 转发通道 -- 新增modbusex扩展参数绑定设备
export function addModbusex(params) {
  return request({
    url: `/transmit/modbusex`,
    method: "POST",
    data: params,
  });
}
// 	 * 转发通道 -- 修改modbusex扩展参数绑定设备
export function editModbusex(params) {
  return request({
    url: `/transmit/modbusex`,
    method: "PUT",
    data: params,
  });
}
// 	 * 转发通道 -- 查询设备id是否绑定了cdt扩展参数
export function getCdtcanshuBind(params) {
  return request({
    url: `/transmit/cdt/bind/${params}`,
    method: "get",
  });
}
// 	 * 转发通道 -- 根据设备id获取cdt扩展参数
export function getCdtcanshu(params) {
  return request({
    url: `/transmit/cdt/${params}`,
    method: "get",
  });
}
// 	 * 转发通道 -- 新增cdt扩展参数绑定设备
export function addCdtcanshu(params) {
  return request({
    url: `/transmit/cdt`,
    method: "POST",
    data: params,
  });
}
// 	 * 转发通道 -- 修改cdt扩展参数绑定设备
export function editCdtcanshu(params) {
  return request({
    url: `/transmit/cdt`,
    method: "PUT",
    data: params,
  });
}

// 	 * 设备编辑 -- 获取设备列表
export function getDeviceList() {
  return request({
    url: `/device_config/device/list/`,
    method: "get",
  });
}
// 	 * 变量编辑 -- 根据设备id 获取变量列表
export function getVariablesDevice(params) {
  return request({
    url: `/variables/device/${params}`,
    method: "get",
  });
}
// 	 * 变量编辑 -- 新增变量
export function addVariables(params) {
  return request({
    url: `/variables/`,
    method: "POST",
    data: params,
  });
}
// 	 * 变量编辑 -- 修改变量
export function editVariables(params) {
  return request({
    url: `/variables/`,
    method: "put",
    data: params,
  });
}
// 	 * 变量编辑 -- 批量修改变量
export function batchEditVariables(params) {
  return request({
    url: `/variables/batch/`,
    method: "put",
    data: params,
  });
}
// 	 * 变量编辑 --删除变量
export function delVariables(params) {
  return request({
    url: `/variables/${params}`,
    method: "DELETE",
  });
}
// 	 * 变量编辑 --批量删除变量
export function batchDelVariables(params) {
  return request({
    url: `/variables/batch_delete/`,
    method: "put",
    data: params,
  });
}
// 	 * 获取协议列表
export function protocolManageProtocol() {
  return request({
    url: `/protocol_manage/protocol`,
    method: "get",
  });
}
// 	 * 上传协议
export function uploadProtocol(params) {
  return request({
    url: `/upload/protocol/`,
    method: "POST",
    headers: {
      "Content-Type": "multipart/form-data", // 必须手动设置
    },
    data: params,
  });
}
// 	 * 修改协议
export function editProtocol(params) {
  return request({
    url: `/protocol_manage/protocol`,
    method: "put",
    data: params,
  });
}
// 	 * 删除协议
export function delProtocol(params) {
  return request({
    url: `/protocol_manage/protocol/${params}`,
    method: "DELETE",
  });
}
// 	 * 导出模板
export function importExportTemplate(params) {
  return request({
    url: `/Export/Template/TemplateRead`,
    method: "post",
    data: params,
  });
}
// 	 * 导入模板
export function importTemplate(params) {
  return request({
    url: `/Import/Template`,
    method: "post",
    data: params,
  });
}
// 	 * 导入模板文件获取模板组名称
export function getSubSeriesList() {
  return request({
    url: `/Import/Template/SubSeriesList`,
    method: "get",
  });
}
// 	 * 导入模板文件获取模板组名称
export function importTemplateFile(params) {
  return request({
    url: `/Import/Template/GroupRead/${params.type}`,
    method: "put",
    headers: {
      "Content-Type": "multipart/form-data", // 必须手动设置
    },
    data: params.files,
  });
}
// 	 * 导入工程
export function ProjectImport(params) {
  return request({
    url: `/Project/Import`,
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data", // 必须手动设置
    },
    data: params,
  });
}
// 	 * 导出工程
export function ProjectExport() {
  return request({
    url: `/Project/Export`,
    method: "put",
  });
}

// 	 * 查询摄像头
export function getCameraList() {
  return request({
    // http://139.199.228.21:8080
    url: `/cameraconfig`,
    method: "get",
  });
}
// 	 * 新增摄像头
export function saveCameraList(params) {
  return request({
    url: `/cameraconfig`,
    method: "post",
    data: params,
  });
}
// 	 * 修改摄像头
export function editCameraList(params) {
  return request({
    url: `/cameraconfig`,
    method: "put",
    data: params,
  });
}
// 	 * 删除摄像头
export function delCameraList(params) {
  return request({
    url: `/cameraconfig`,
    method: "DELETE",
    data: params,
  });
}
// 	 * 打开摄像头采集程序
export function opencameraconfig() {
  return request({
    url: `/cameraconfig/turn_on`,
    method: "get",
  });
}
// 	 * 关闭摄像头采集程序
export function offcameraconfig() {
  return request({
    url: `/cameraconfig/turn_off`,
    method: "get",
  });
}
// 	 * 网络配置 -- 查询所有网卡信息
export function getNetworkConfigList() {
  return request({
    url: `/system/networkconfig`,
    method: "get",
  });
}
// 	 * 网络配置 -- 修改网卡信息
export function editNetworkConfigList(params) {
  return request({
    url: `/system/networkconfig`,
    method: "put",
    data: params,
  });
}

// 	 * MQTT配置 -- 查询所有MQTT客户端记录
export function getMQTTClientConfig() {
  return request({
    url: `/mqtt/client_config`,
    method: "get",
  });
}
// 	 * MQTT配置 -- 添加一个mqtt客户端
export function saveMQTTClientConfig(params) {
  return request({
    url: `/mqtt/client_config`,
    method: "post",
    data: params,
  });
}
// 	 * MQTT配置 -- 修改一条MQTT客户端记录
export function editMQTTClientConfig(params) {
  return request({
    url: `/mqtt/client_config`,
    method: "put",
    data: params,
  });
}
// 	 * MQTT配置 -- 删除一条MQTT客户端记录
export function delMQTTClientConfig(params) {
  return request({
    url: `/mqtt/client_config`,
    method: "DELETE",
    data: params,
  });
}

// 	 * 物模型配置 -- 查询所有物模型记录
export function getModelLists() {
  return request({
    url: `/mqtt/model_lists`,
    method: "get",
  });
}
// 	 * 物模型配置 -- 添加一个物模型
export function saveModelLists(params) {
  return request({
    url: `/mqtt/model_lists`,
    method: "post",
    data: params,
  });
}
// 	 * 物模型配置 -- 修改一条物模型记录
export function editModelLists(params) {
  return request({
    url: `/mqtt/model_lists`,
    method: "put",
    data: params,
  });
}
// 	 * 物模型配置 -- 删除一条物模型记录
export function delModelLists(params) {
  return request({
    url: `/mqtt/model_lists`,
    method: "DELETE",
    data: params,
  });
}

// 	 * 物模型配置 -- 查询所有物模型记录
export function getModelRecord() {
  return request({
    url: `/mqtt/model`,
    method: "get",
  });
}
// 	 * 物模型配置 -- 添加一个物模型
export function saveModelRecord(params) {
  return request({
    url: `/mqtt/model`,
    method: "post",
    data: params,
  });
}
// 	 * 物模型配置 -- 修改一条物模型记录
export function editModelRecord(params) {
  return request({
    url: `/mqtt/model`,
    method: "put",
    data: params,
  });
}
// 	 * 物模型配置 -- 删除一条物模型记录
export function delModelRecord(params) {
  return request({
    url: `/mqtt/model`,
    method: "DELETE",
    data: params,
  });
}
// 	 * 生成点号
export function GenerateNumfn(params) {
  return request({
    url: `/device_template/data_number/${params}`,
    method: "put",
  });
}
// 	 * 发送探测广播
export function ipSendBroadcast() {
  return request({
    url: `/ip_detect/send_broadcast`,
    method: "post",
  });
}
// 	 * 查询局域网内ip列表
export function getipdetect() {
  return request({
    url: `/ip_detect/device_ips`,
    method: "get",
  });
}

// 	 * 登录
export function weblogin(params) {
  return request({
      url: "/userLogin/login",
    method: "post",
    data: params,
  });
}
// 	 * 修改密码
export function changePasswd(params) {
  return request({
    url: `/userLogin/chpasswd`,
    method: "post",
    data: params,
  });
}

// 	 * 查询全部变量
export function getvAllAriablesList() {
  return request({
    url: `/variables/list/`,
    method: "get",
  });
}

// 	 * 保存转发变量
export function saveForward(params) {
  return request({
    url: `/transmit/transfer_variable/update/`,
    method: "post",
    data: params,
  });
}
